//
//  OMDeliveryBaseAddressTableCell.m
//  OMENGO_NEW
//
//  Created by 梁尚嘉 on 2017/5/3.
//  Copyright © 2017年 Kamfat. All rights reserved.
//

#import "OMDeliveryBaseAddressTableCell.h"
@interface OMDeliveryBaseAddressTableCell ()
@property (nonatomic, strong) UIView *topLine;
@property (nonatomic, strong) UIView *bottomLine;
@end

@implementation OMDeliveryBaseAddressTableCell

- (void)configure
{
    [super configure];
    [self.contentView addSubview:self.containView];
    [self.contentView addSubview:self.topLine];
    [self.contentView addSubview:self.bottomLine];
    [self.contentView addSubview:self.bottomBar];
    [self.containView addSubview:self.nameLabel];
    [self.containView addSubview:self.phoneLabel];
    [self.containView addSubview:self.addressLabel];

    [self.containView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.equalTo(@0);
    }];

    [self.topLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.equalTo(@0);
        make.height.equalTo(@0.5f);
    }];

    [self.bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(@0);
        make.bottom.equalTo(self.bottomBar.mas_top);
        make.height.equalTo(@0.5f);
    }];

    [self.addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(@(SM_SIZE(30)));
        make.right.equalTo(@(SM_SIZE(-30)));
    }];

    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.addressLabel.mas_left);
        make.top.equalTo(self.addressLabel.mas_bottom).offset(SM_SIZE(15));
        make.width.lessThanOrEqualTo(@(SM_SCREEN_WIDTH-SM_SIZE(30)*2-SM_SIZE(20)-(SM_SIZE(27)*11/2.f)));
        make.bottom.equalTo(@(SM_SIZE(-25)));
    }];

    [self.phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.nameLabel.mas_centerY);
        make.left.equalTo(self.nameLabel.mas_right).offset(SM_SIZE(20));
    }];

    [self.bottomBar mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.bottom.equalTo(@0);
        make.left.equalTo(self.containView.mas_left);
        make.height.equalTo(@(SM_SIZE(15)));
        make.top.equalTo(self.containView.mas_bottom).offset(SM_SIZE(0));
    }];
}

- (UIView *)containView
{
    if (!_containView) {
        _containView = [UIView new];
    }
    return _containView;
}


- (UILabel *)nameLabel
{
    if (!_nameLabel) {
        _nameLabel = [UILabel new];
        _nameLabel.textColor = SM_darkGrayColor;
        _nameLabel.font = SM_CFont(26);
    }
    return _nameLabel;
}

- (UILabel *)phoneLabel
{
    if (!_phoneLabel) {
        _phoneLabel = [UILabel new];
        _phoneLabel.textColor = SM_darkGrayColor;
        _phoneLabel.font = SM_CFont(26);
    }
    return _phoneLabel;
}

- (UILabel *)addressLabel
{
    if (!_addressLabel) {
        _addressLabel = [UILabel new];
        _addressLabel.font = SM_CFont(31);
        _addressLabel.textColor = SM_blackColor;
    }
    return _addressLabel;
}

- (UIView *)topLine
{
    if (!_topLine) {
        _topLine = [UIView new];
        _topLine.backgroundColor = HEXCOLOR(@"e4e4e4");;
    }
    return _topLine;
}

- (UIView *)bottomLine
{
    if (!_bottomLine) {
        _bottomLine = [UIView new];
        _bottomLine.backgroundColor = HEXCOLOR(@"e4e4e4");;
    }
    return _bottomLine;
}

- (UIView *)bottomBar
{
    if (!_bottomBar) {
        _bottomBar = [UIView new];
        _bottomBar.backgroundColor = SM_backGroundColor;
    }
    return _bottomBar;
}

@end
